<?php


namespace app\home\service;


class CodeService
{


    /**
     * 系统
     */
    const OPERATE           ='操作成功';
    const SUCCESS           ="返回成功";
    const FULL           ="操作失败";
    const REQUEST_NOT_FOUND = ['code'=>404,'msg'=>'访问地址不存在'];//访问地址不存在
    const REQUEST_METHOD_ERROR = ['code'=>405,'msg'=>'请求方式不正确'];//请使用接口文档定义的请求方式调用
    const HTTP_ERROR = ['code'=>500,'msg'=>'服务器内部错误'];//服务器内部错误
    const SERVER_ERROR_TRY_AGAIN_LATER =['code'=>501,'msg'=>'服务器开小差了!请稍后重试'] ;//服务器开小差了!请稍后重试
    const MISSING_PARAMETERS       = ['code'=>1004104100,'msg'=>'缺少参数'];//缺少参数

    const SYSTEM_BUSY =['code'=>1005104001,'msg'=>'系统繁忙!'] ;//系统繁忙
//    const SYSTEM_BUSY_PLEASE_TRY_AGAIN_LATER =['code'=>1005104002,'msg'=>'系统繁忙!请稍后重试'] ;//服务器开小差了!请稍后重试
    //验证码
    const VERIFICATION_CODE_ERROR       = ['code'=>1005104103,'msg'=>'验证码错误'];//验证码错误
    const VERIFICATION_CODE_EMPTY       = ['code'=>10070105,'msg'=>'验证码不能为空'];//验证码不能为空
    //登录
    const AUTH_FAILD    = ['code'=>1005104100,'msg'=>'登录失效，请重新登录']; //登录失效，请重新登录
    const AUTH_TIMEOUT  = ['code'=>1005104101,'msg'=>'登录已过期，请重新登录'];//登录已过期，请重新登录
    const AUTH_REQUIRD  = ['code'=>1005104102,'msg'=>'请登录'];//请登录
    const AUTH_USER_DOES_IT_EXIST   =['code'=>1005104201,'msg'=>'未注册'];
    const AUTH_USER_IT_EXIST        =['code'=>1005104202,'msg'=>'已注册'];
    //图片
    const IMAGE_SIZE_VERIFICATION   = ['code'=>1003104100,'msg'=>'请上传小于3M的图片'];//请上传小于3M的图片
    const IMAGE_COUNT_VERIFICATION  = ['code'=>1003104101,'msg'=>'最多三张图片'];//最多三张图片
    const IMAGE_TYPE = ['code'=>1003104102,'msg'=>'仅支持jpg/jpeg/png'];//仅支持jpg/jpeg/png
    const DETECTION_CATE=["code"=>1003104103,"msg"=>"分类不能为空"];

    //产品
    const PRODUCT_DOES_NOT_EXIST = ['code'=>1006104101,'msg'=>'产品不存在'];//产品不存在
    const EXCEEDING_INTERVAL_LIMIT = ['code'=>1006104102,'msg'=>'价格设定不可超过平台上限，请合理设定推广价'];
    const NOT_LOWER_THAN_COST = ['code'=>1006104103,'msg'=>'推广价不可低于成本价'];
    const PRODUCT_IS_OFFLINE = ['code'=>1006104104,'msg'=>'产品已下架'];
    const REPEATED_SUBMISSION = ['code'=>1006104105,'msg'=>'重复提交'];
    const PARAMETER_EXCEPTION = ['code'=>1006104106,'msg'=>'参数异常'];
    const REPORT_GET_FULL = ['code'=>1006104107,'msg'=>'获取失败'];


    /**用户
     * 订单
     */
    const ORDER_REPORT_ID       = ['code'=>10070101,'msg'=>'报告id不能为空'];
    const ORDER_REPORT_ID_CODE       = ['code'=>10070100,'msg'=>'报告ID,报告编码必须有一个'];
    const ORDER_USER_NAME       = ['code'=>10070102,'msg'=>'用户姓名不能为空'];
    const ORDER_USER_PHONE      = ['code'=>10070103,'msg'=>'用户手机号不能为空'];
    const ORDER_USER_IDNUM      = ['code'=>10070104,'msg'=>'用户身份证不能为空'];
    const ORDER_EMPTY_ID        = ['code'=>10070110,'msg'=>'订单ID不能为空'];
    const ORDER_USER_DEALER_CODE     = ['code'=>10070105,'msg'=>'代理编码不能为空'];//代理编码不能为空
    const ORDER_USER_DEALER_INFO     = ['code'=>10070106,'msg'=>'未找到代理信息'];//未找到代理信息
    const ORDER_USER_REPORT_INFO     = ['code'=>10070107,'msg'=>'未找到报告信息'];//未找到代理信息
    const ORDER_USER_ORDER_INFO     = ['code'=>10070108,'msg'=>'未找到订单信息'];//未找到订单信息
    const ORDER_USER_ORDER_NOPAY     = ['code'=>10070109,'msg'=>'该订单未支付'];//该订单未支付
    const ORDER_USER_ORDER_PAYFULL     = ['code'=>10070110,'msg'=>'该订单支付失败'];//该订单支付失败
    const ORDER_USER_ORDER_REFUND     = ['code'=>10070111,'msg'=>'该订单已退款'];//该订单已退款
    const DATA_RESULT_REFUND            = ['code'=>10070112,'msg'=>'数据错误'];//该订单已退款
    const ORDER_CODE                    = ["code"=>10070113,"msg"=>"订单编号不能为空"];
    const ORDER_RETURN_URL                    = ["code"=>10070114,"msg"=>"回调地址为空"];
    const ORDER_PAY_TYPE                      = ["code"=>10070115,"msg"=>"请选择支付方式"];
    const INSPECTION_NO                      = ["code"=>10070116,"msg"=>"订单检测失败"];
    const INSPECTION_PAY_NO                      = ["code"=>10070117,"msg"=>"订单支付检测失败"];
    const ORDER_USER_PAY_YES                      = ["code"=>10070118,"msg"=>"该订单已经支付"];
    const ORDER_CREAT_FULL                      = ["code"=>10070119,"msg"=>"订单创建失败"];
    const ORDER_YFG_FULL                      = ["code"=>10070120,"msg"=>"订单已失效"];
    const ORDER_YES_SUCCESS                      = ["code"=>10070121,"msg"=>"该订单已获取"];
    const ORDER_DELETE                      = ["code"=>10070121,"msg"=>"该订单已删除"];
    const ORDER_FFROM                      = ["code"=>10070122,"msg"=>"渠道来源不能为空"];
    const ORDER_ANSWER                      = ["code"=>10070123,"msg"=>"答案不能为空"];
    const ORDER_TO_AGIN                      = ["code"=>10070124,"msg"=>"请重新获取"];

    //排行榜
    const RANKING_LIST              =["code"=>10070199,"msg"=>"类型不能为空"];
    const RED_MSG              =["code"=>10070200,"msg"=>"消息ID不能为空"];
    /**成功返回数据*格式
     * @param int $code
     * @param null $msg
     * @param array $data
     * @return array
     */
    public static function response($code = 200,$msg = null,$data = []){
        header('Content-type: application/json');
        $array = [
            "code" => $code,
            "msg"  => $msg,
            "data" => $data

        ];
        return $array;

    }

}